-
Notifications
You must be signed in to change notification settings - Fork 296
loongarch: Add basic support for LoongArch32 #1837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
/// Calculate the approximate double-precision result of dividing 1.0 by the square root | ||
#[inline] | ||
#[target_feature(enable = "frecipe")] | ||
#[unstable(feature = "stdarch_loongarch", issue = "117427")] | ||
pub unsafe fn frsqrte_d(a: f64) -> f64 { | ||
__frsqrte_d(a) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like llvm will just optimize this (no target feature is even needed): https://godbolt.org/z/5s6hvKE51.
Overall we prefer to have fewer (manual) extern "unadjusted¨
items. Also you should probably add some tests that these instructions actually produce the instructions you expect, like so
#[cfg_attr(all(test, target_feature = "frecipe"), assert_instr(frsqrt.d))]
assuming that frecipe
is enabled on CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like llvm will just optimize this (no target feature is even needed): https://godbolt.org/z/5s6hvKE51.
They're different -- frsqrte_d_manual
generates frsqrt.d
, not frsqrt**e**.d
.
Overall we prefer to have fewer (manual)
extern "unadjusted¨
items. Also you should probably add some tests that these instructions actually produce the instructions you expect, like so#[cfg_attr(all(test, target_feature = "frecipe"), assert_instr(frsqrt.d))]
assuming that
frecipe
is enabled on CI.
Sure, I'll add more test cases. Perhaps in a separate PR to keep things focused. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, my bad. so the "e" is for "estimate" apparently. Maybe use that word? (most functions on floats approximate the answer, but apparently this intrinsic deliberately uses less precision to achieve higher speed).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, exactly. 😄
No description provided.